import request from '@/utils/request'

export const userLogApi = {
  // 创建用户日志
  createUserLog: (log) => {
    return request.post('/api/user-logs', log)
  },

  // 获取用户日志详情
  getUserLog: (id) => {
    return request.get(`/api/user-logs/${id}`)
  },

  // 删除用户日志
  deleteUserLog: (id) => {
    return request.delete(`/api/user-logs/${id}`)
  },

  // 获取用户日志列表
  getUserLogs: (page = 1, size = 10) => {
    return request.get('/api/user-logs', {
      params: { page, size }
    })
  },

  // 获取指定用户的日志
  getUserLogsByUser: (userId) => {
    return request.get(`/api/user-logs/user/${userId}`)
  },

  // 获取指定操作的日志
  getUserLogsByAction: (action) => {
    return request.get(`/api/user-logs/action/${action}`)
  },

  // 获取时间范围内的日志
  getUserLogsByTimeRange: (start, end) => {
    return request.get('/api/user-logs/time-range', {
      params: { start, end }
    })
  },

  // 删除指定时间之前的日志
  deleteLogsBefore: (beforeTime) => {
    return request.delete('/api/user-logs/before', {
      params: { beforeTime }
    })
  }
} 